import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import postcss from 'rollup-plugin-postcss';
import { terser } from 'rollup-plugin-terser';

export default {
  input: 'src/index.js',
  output: {
    file: 'lib/trackline_visual_lib.js',
    format: 'esm',
    sourcemap: true,
  },
  external: ['react', 'react-dom'],
  plugins: [
    peerDepsExternal(),
    resolve({
      extensions: ['.js'],
    }),
    babel({
      babelHelpers: 'bundled',
      exclude: 'node_modules/**',
      extensions: ['.js'],
      babelrc: true,
    }),
    commonjs(),
    postcss(),
    terser(),
  ],
};